{% extends "base.html" %}

<!--  -->
{% block styles %}
<link href="/static/student_list.css" rel="stylesheet"/>
<script src="/static/data.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{% endblock %}

<!--  -->
{% block page_content %}
<div class="paper">
    <h3>学生名单管理</h3>
    <!--    <div>待实现...</div>-->
    <form class="grade-form" action="/student_seach" method="post">

        <label>学生：</label>
        <select name="stu_sn">
            <option value="">--选择--</option>
            {% for stu in students %}
            <option value="{{stu.stu_sn}}">
                {{ stu.stu_name }}({{ stu.stu_sn }})
            </option>
            {% endfor %}
        </select>

        <!--        <label>成绩：</label>-->
        <!--        <input type="text" name="grade"/>-->

        <input type="submit" value="查询"/>


    </form>
    <!-- 新增导出按钮 -->
    <button onclick="exportTableToCSV($('#grade-table'), 'grades.csv');">导出为CSV</button>

    <hr/>
    <table id="grade-table">
        <tr>
            <th>姓名</th>
            <th>课程</th>
            <th>班次</th>
            <th>成绩</th>
            <!--            <th>操作</th>-->
        </tr>
        {% for item in items %}
        <tr>
            <td>{{ item.stu_name }}</td>
            <td>{{ item.cou_name }}</td>
            <td>{{ item.cla_name }}</td>
            <td>{{ item.grade }}</td>
            <!--            <td>-->
            <!--                <div class="ctrlbar">-->
            <!--                    <div class="btn">-->
            <!--                        <a href="/grade/edit/{{item.stu_sn}}/{{item.cou_sn}}">-->
            <!--                            修改-->
            <!--                        </a>-->
            <!--                    </div>-->
            <!--                    <div class="btn">-->
            <!--                        <a href="/grade/delete/{{item.stu_sn}}/{{item.cou_sn}}">-->
            <!--                            删除-->
            <!--                        </a>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--            </td>-->
        </tr>
        {% endfor %}
    </table>
</div>
{% endblock %}

